package com.idis.userApp;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication(scanBasePackages = {"com.idis.service","com.idis.userApp"},exclude = {DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
@EntityScan("com.idis.entity")
@EnableSwagger2
public class UserAppApplication {
	public static void main(String[] args) {
		SpringApplication.run(UserAppApplication.class, args);
	}

	@Value("${ip}")
	String ip;

	@Value("${port}")
	String port;

	@Bean
	public String DBUrl(){
		return "http://"+ip+":"+port;
	}

	@Bean
	public org.springframework.web.client.RestTemplate restTemplate(RestTemplateBuilder builder) {
		return builder.build();
	}
}
